package com.sxjh.controller.pub;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sxjh.common.BaseController;
import com.sxjh.common.Result;
import com.sxjh.entity.Materials;
import com.sxjh.entity.result.MaterialListResult;
import com.sxjh.service.MaterialsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 物料  前端控制器
 * </p>
 *
 * @author zixin
 * @since 2021-06-05
 */
@RestController
@RequestMapping("/material2")
@Api(tags = "物料")
public class Material2Controller extends BaseController {

  @Autowired
  private MaterialsService materialsService;

  @ApiOperation("列表")
  @GetMapping
  Result<List<MaterialListResult>> list() {
    List<Materials> list = materialsService.list(
            new LambdaQueryWrapper<Materials>()
                    .isNull(Materials::getDeletedAt));
    List<MaterialListResult> results = copyList(list, MaterialListResult::new);
    return Result.ok(results);
  }

}
